<?php echo $this->doctype() ?>
<html>
<head>
    <?php 
    	$this->headTitle('Smoothie lab');
    	echo $this->headTitle() 
    ?>
   	<?php echo $this->headMeta() ?>
   	<?php echo $this->headLink() ?>
   	<?php echo $this->headScript() ?>
   	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   	<link rel="shortcut icon" href="public/Images/" type="image/x-icon" />
   	<title>Smoothie lab</title>

</head>
<body>
	<?php 
		//$this->jQuery()->enable();
		$this->jQuery()->setLocalPath($this->baseUrl() . '/public/jquery/js/jquery-1.6.2.min.js')
		                ->setUiLocalPath($this->baseUrl() . '/public/jquery/js/jquery-ui-1.8.16.custom.min.js')
	                	->addStyleSheet($this->baseUrl() . '/public/jquery/css/uilightness/jquery-ui-1.8.16.custom.css')
	                	->addStyleSheet($this->baseUrl() . '/public/css/smoothie.css');
		$this->jQuery()->uiEnable();
		echo $this->jQuery();
		$scheduleLink = $this->url(array('module' => 'user','controller'=>'index','action'=>'schedule'), null, TRUE);
		$actionLink = $this->url(array('module' => 'user','controller'=>'index','action'=>'order'), null, TRUE);
		if (isset($this->auth)) {
			if ($this->auth->roleStr == 'admin') {
				$actionLink = $this->url(array('module' => 'admin','controller'=>'index','action'=>'index'), null, FALSE);
			}
		}
	?>
	<script>
	     $(document).ready(function(){
	    	var inter = self.setInterval("clock()",1000);
	 		
	     });
	     function clock()
	 	 {
	    	$.ajax({
	    		  url: <?php echo "'".$this->url(array('module' => 'front', 
					'controller' => 'utils', 'action' => 'currenttime'))."'";?>,
	    		  success: function(data){
				 	document.getElementById('clock').innerHTML = 'Today: ' + data;
	    		  }
	    	});
	 		
	 	 }
    </script>
	<table width = "850px" align = "center" style = "background-color:white">
		<tr>
			<td>
				<table>
					<tr height = "20px">
					</tr>
					<tr>
						<td><a style = 'margin-right:20px; height:30px;font-size:25px;' href = '<?php echo $this->url(array('module' => 'front','controller'=>'index','action'=>'index'), null, TRUE);?>'>Menu</a></td>
						<td><a style = 'margin-right:20px; height:30px;font-size:25px;' href = '<?php echo $scheduleLink;?>'>Schedule</a></td>
						
						<td>
							<?php if (!isset($this->auth)) {?>
								<a style = 'margin-right:20px; height:30px;font-size:25px;' href = '<?php echo $this->url(array('module' => 'front','controller'=>'authentication','action'=>'login'), null, TRUE);?>'>Login</a>
							<?php } else { ?>
								<a style = 'margin-right:20px; height:30px;font-size:25px;' href = '<?php echo $this->url(array('module' => 'front','controller'=>'authentication','action'=>'logout'), null, TRUE);?>'>Logout</a>
							<?php } ?>
						</td>
						<?php 
							if (isset($this->auth)) {
						?>
						<td>
								<p style = 'height:30px;font-size:25px;'>Hello, <?php echo $this->auth->fullname;?></p>
						</td>
						<td>
							<a style = "margin-left:20px;font-size:25px;" href = "<?php echo $actionLink;?>">Home</a>
						</td>
						<?php 
						
							}
						?>
								
					</tr>
				</table>
			</td>
		</tr>
		<tr height = "10px">
			<td>
				<div style = 'font-size:15px;' id = 'clock'>Today: <?php echo date("d-m-Y H:i:s")?></div>
			</td>
		</tr>
		<tr><td><?php echo $this->layout()->content ?></td></tr>
	</table>
    
</body>
</html>